<!doctype html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<pre id='console'></pre>
<script>
description("Test FileReader methods and their argument type checking.");

if (window.testRunner)
    testRunner.dumpAsText();

var blob = new Blob(["aa"]);
var fileReader;
var method;
function testReadMethod(name)
{
    fileReader = new FileReader();
    shouldThrow("fileReader." + name + "();");
    shouldThrow("fileReader." + name + "(2);");
    shouldThrow("fileReader." + name + "(null)");
    shouldThrow("fileReader." + name + "(fileReader)");
    shouldThrow("fileReader." + name + "([])");
    shouldNotThrow("fileReader." + name + "(blob, 'utf-8')");
    shouldThrow("fileReader." + name + "(blob)");
}

var methods = [ "readAsArrayBuffer", "readAsBinaryString", "readAsText", "readAsDataURL" ];

methods.forEach(function (m) { testReadMethod(m); });

</script>
</body>
</html>
